<h1 class="page-header">产品详情</h1>
<style>
    .goodTags{
        margin: 5px 0 0 0px;
        width: 360px;
    }
    .goodTags span{
        margin: 5px;
        border: 1px solid green;
        display: inline-block;
        font-size: 12px;
        cursor: pointer;
        padding: 5px;
    }

    .goodTags .tagBG {
        border: 1px solid gold;
    }


</style>
<form class="form-horizontal" name="form" role="form" ng-controller="goodsFormCtrl" novalidate>
    <div class="form-group">
        <div class="col-md-6">
            <label class="control-label col-md-2">产品名称:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="goodsName" ng-model="goods.goods_name" />

            </div>
        </div>
        <div class="col-md-6">
            <label class="control-label col-md-2">子产品名称:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="subGoodsName" ng-model="goods.subGoodsName" />

            </div>

        </div>
    </div>
    <div class="form-group">
        <div class="col-md-6">

            <label class="control-label col-md-2">价格:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="price" ng-model="goods.price" smart-float/>

                <strong class="text-danger" ng-show="form.price.$error.float">请输入有效价格!</strong>
            </div>

        </div>
        <div class="col-md-6">

            <label class="control-label col-md-2">市场价格:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="marketPrice" ng-model="goods.market_price" smart-float/>

                <strong class="text-danger" ng-show="form.marketPrice.$error.float">请输入有效价格!</strong>
            </div>

        </div>
    </div>
    <div class="form-group">
        <div class="col-md-6">
            <label class="control-label col-md-2">国家:</label>
            <div class="col-md-6">
                <select class="form-control" ng-model="goods.country" ng-options="country.name as country.name for country in countries"></select>
            </div>
        </div>

        <div class="col-md-6">
            <label class="control-label col-md-2">单支规格:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="norm" ng-model="goods.mgrade_norm"  smart-float/>
                <strong class="text-danger" ng-show="form.norm.$error.float">请输入有效规格!</strong>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-6">
            <label class="control-label col-md-2">成分:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" ng-model="goods.mgrade_ingredients" />
            </div>
        </div>
        <div class="col-md-6">

            <label class="control-label col-md-2">酒庄:</label>
            <div class="col-md-6">
                <select class="form-control" ng-model="goods.wineryId">
                    <option  ng-repeat="item in wineryList" value="{{item.id}}">{{item.name}}</option>
                </select>
            </div>

        </div>
    </div>

    <div class="form-group">
        <input type="hidden" ng-model="goods.goods_id">
        <div class="col-md-6">
            <label class="control-label col-md-2">酒精度(%vol):</label>
            <div class="col-md-6">
                <input type="text" class="form-control" name="alcohol" ng-model="goods.mgrade_alcohol"  smart-float/>
                <strong class="text-danger" ng-show="form.alcohol.$error.float">请输入有效酒精度!</strong>
            </div>
        </div>
        <div class="col-md-6">

            <label class="control-label col-md-2">年份:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" ng-model="goods.mgrade_year" />
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-6">
            <label class="control-label col-md-2">地区:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" ng-model="goods.mgrade_areas" />
            </div>
        </div>
        <div class="col-md-6">

            <label class="control-label col-md-2">等级:</label>
            <div class="col-md-6">
                <input type="text" class="form-control" ng-model="goods.mgrade_grade"/>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-6">
            <label class="control-label col-md-2">产品类别1:</label>
            <div class="col-md-6">
                <select class="form-control" ng-model="goods.cate_id_1">
                    <option  ng-repeat="item in categoryList | filter:{'parent_id' : 0}" value="{{item.cate_id}}">{{item.cate_name}}</option>
                </select>
            </div>

        </div>
        <div class="col-md-6">
            <label class="control-label col-md-2">产品类别2:</label>
            <div class="col-md-6">
                <select class="form-control" ng-model="goods.cate_id_2">
                    <option  ng-repeat="item in categoryList | categoryFilter:goods.cate_id_1" ng-selected="item.cate_id == goods.cate_id_2" value="{{item.cate_id}}">{{item.cate_name}}</option>
                </select>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-md-6">
            <label class="control-label col-md-2">获奖信息:</label>
            <div class="col-md-6">
                <textarea class="form-control" rows="5" ng-model="goods.prizeinfo"></textarea>
            </div>

        </div>
        <div class="col-md-6">
            <label class="control-label col-md-2">产品描述</label>
            <div class="col-md-6">
                <textarea class="form-control" rows="5" ng-model="goods.description"></textarea>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-md-6">

            <label class="control-label col-md-2">标签:</label>
            <div class="col-md-8">
                <input type="text" class="form-control" ng-model="goods.tags"/>
                <p class="goodTags">
                    <span ng-click="selectTag(tag)" ng-class="{'tagBG' : hasTag(tag)}" ng-repeat="tag in tagList" ng-bind="tag"></span>
                </p>
            </div>
        </div>

        <div class="col-md-6">
            <label class="control-label col-md-2">配餐建议</label>
            <div class="col-md-6">
                <textarea class="form-control" rows="5" ng-model="goods.recipe"></textarea>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-md-6">
            <label class="control-label col-md-2">产地介绍</label>
            <div class="col-md-6">
                <textarea class="form-control" rows="5" ng-model="goods.origin"></textarea>
            </div>
        </div>
    </div>



    <div class="form-group">
        <div class="col-md-6">
            <label class="control-label col-md-2">限时折扣:</label>
            <div class="col-md-1">
                <input type="checkbox" ng-checked="goods.sales == 1" ng-click="onChange(1)">
            </div>

            <label class="control-label col-md-2">新品推荐:</label>
            <div class="col-md-1">
                <input type="checkbox" ng-checked="goods.isNew == 1" ng-click="onChange(2)">
            </div>

            <label class="control-label col-md-2">可能感兴趣:</label>
            <div class="col-md-1">
                <input type="checkbox" ng-checked="goods.recommended == 1" ng-click="onChange(3)">
            </div>

            <label class="control-label col-md-2">爆款清仓:</label>
            <div class="col-md-1">
                <input type="checkbox" ng-checked="goods.hot == 1" ng-click="onChange(4)">
            </div>
        </div>
    </div>




    <div class="form-group">
        <div class="col-md-offset-5 col-md-12">
            <a class="btn btn-success" ng-click="save();" ng-disabled="form.$invalid">保存</a>
            <a class="btn btn-primary" data-target="#closeModal" data-toggle="modal">取消</a>
        </div>
    </div>

    <div class="modal fade" id="closeModal" tabindex="-1" role="dialog" aria-labelledby="closeModal"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title">
                        退出
                    </h4>
                </div>
                <div class="modal-body">
                    确认退出编辑？
                </div>
                <p class="bg-danger"></p>
                <span class="success-message"></span>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">取消
                    </button>
                    <input type="button" value="确定" class="btn btn-warning" ng-click="closeModal();" />

                </div>
            </div>
        </div>
    </div>
</form>